package top.hkyzf.onekeycommand.event;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.util.ActionResult;

/**
 * description: 聊天事件的回调
 * @author zhufeng
 * @date 2022/9/23 22:22
 * @version V1.0
 */
public interface ChatCallback {
    Event<ChatCallback> CHAT_EVENT = EventFactory.createArrayBacked(ChatCallback.class, listeners -> message -> {
        for (ChatCallback listener : listeners) {
            ActionResult result = listener.interact(message);
            if (result != ActionResult.PASS) {
                return result;
            }
        }
        return ActionResult.PASS;
    });

    ActionResult interact(String message);
}
